package com.matrix.java.chap_05;
/*
    财务应用程序：求出销售总额
 */
public class Ex5_39 {
    public static void main(String[] args) {
        double sales;
        for (int i = 1;; i++) {
            double income = 0;
            sales=i;
            for (int j = 1; j <= 12; j++) {
                if (sales<5000){
                    income+=sales*0.08;
                }else if (sales<10000){
                    income+=5000*0.08+(sales-5000)*0.1;
                }else {
                    income+=5000*0.08+5000*0.1+(sales-10000)*0.12;
                }
                sales=i+j;
            }
            if (income>=30000){
                sales =i;
                break;
            }
        }
        System.out.println(sales);
    }
}
